// 		 Main script for module '--- STORY ---'
//-----------------------------------------------------------------------------
// Flash puzzles:	1. default: remember something. Variation: link many things (e.g. candelabra)
// 				2. make a shape: angels.
// 				3. shoot. variation: object continually shoots, you changes its direction. Variation: destroyed object spawns.
// 				4. move objects into position (levers, etc)	variation 1: Heath Robinson. variation 2: nudge something - e.g. whirlwind
// 				5. Pacman: move and 'eat' stuff while someone chases you
// 				6. Moving back=ground. e.g. coach race avoid rocks; bubbles - avoid hitting. variation: shoot at the same time.
//--------------------------------------------------------------------------------------------------------
// Story key:  problem: 	freedom implies infinite needs. solution: RUSH the user through the desired path.
//--------------------------------------------------------------------------------------------------------
// "XnoScale[unreliable],unlock,Xface(),Xspeech(),Xview(),Xloop(only if canTurn),Xframe(),Xidle(),Xtint(red255,blu255,grn255,luminance255)[unreliable],XnoBehind,XyesBehind"
function tNote(){translatorHelp ="X ********** TRANSLATOR: This is the essential story code. Where there are two similar names, and one starts or ends with a space, e.g. 'rockface' and ' rockface', the space is VERY IMPORTANT ********";}
// special case for chemist shop ---------------------------------------------
function namePrep(GUIControl* label, what, which) // e.g. 'arrow1' corresponds with hotspot '1'
{	if(which ==1){whatPrep =var.Format("preparation %s",what);
            label.AsLabel.Text =var.Format("Preparation %s: patent antidote[   (for common poisons)",what); 
  }else    {whatPrep2 =var.Format("preparation %s",what);
            if(whatPrep2 ==whatPrep){whatPrep2 =""; return false;}
            label.AsLabel.Text =var.Format("Preparation %s:  arrhythmius[   (for faking death)",what); 
            }return true;
}
function choosePreparation( which)// choose 2 preparations
{	var i =Random(25);// 0-25 =26 choices
	if(i ==0)return namePrep(book26A,"A",which);  if(i ==1)return namePrep(book26B,"B",which);
	if(i ==2)return namePrep(book26C,"C",which);  if(i ==3)return namePrep(book26D,"D",which);
	if(i ==4)return namePrep(book26E,"E",which);  if(i ==5)return namePrep(book26F,"F",which);
	if(i ==6)return namePrep(book26G,"G",which);  if(i ==7)return namePrep(book26H,"H",which);
	if(i ==8)return namePrep(book26I,"I",which);  if(i ==9)return namePrep(book26J,"J",which);
	if(i ==10)return namePrep(book26K,"K",which); if(i ==11)return namePrep(book26L,"L",which);
	if(i ==12)return namePrep(book26M,"M",which); if(i ==13)return namePrep(book26N,"N",which);
	if(i ==14)return namePrep(book26O,"O",which); if(i ==15)return namePrep(book26P,"P",which);
	if(i ==16)return namePrep(book26Q,"Q",which); if(i ==17)return namePrep(book26R,"R",which);
	if(i ==18)return namePrep(book26S,"S",which); if(i ==19)return namePrep(book26T,"T",which);
	if(i ==20)return namePrep(book26U,"U",which); if(i ==21)return namePrep(book26V,"V",which);
	if(i ==22)return namePrep(book26W,"W",which); if(i ==23)return namePrep(book26X,"X",which);
	if(i ==24)return namePrep(book26Y,"Y",which); if(i ==25)return namePrep(book26Z,"Z",which);
}
//===============================================================================
// 					MAKE GOAL + MOTIVATION CLEAR AT EVERY STAGE. Drama =opposition.
//===============================================================================
function prepareStory()
{	whatPrep =""; whatPrep2 =""; var xFrz =0;
  choosePreparation(1);
  while(whatPrep2 ==""){choosePreparation(2); // keep trying until you get something different
                        xFrz++; if(xFrz >100){Display("bug message 1");
                        whatPrep2 =whatPrep;}} // highly unlikely, but I don't like 'while' loops
  
  eState[0] =3; 						// mark as done (just in case - empty 'dependsOn' field means 'dependsOn 0')
 //----------------------------------------------------------------------------------------------
event =BEFORE_GAME_0;			// add them this way so they're added by 'jumpToEvent'
	eState[BEFORE_GAME_0] =3; // mark as done
		needs(EVIL_M,34,96,395,"");//in cabin, old costume
   eState[BEFORE_GAME_1] =3; // mark as done
//----------------------------------------------------------------------------------------------
event =BEFORE_GAME_1;		// up to 20 people per event
		// people who might walk off during the game
//----------------------------------------------------------------------------------------------
event =BEFORE_GAME_2;
		eState[BEFORE_GAME_2] =3; // mark as done
		// people who might move during the game
//===============================================================================
event =OPENING_SCENE; // PRISON CELL: despair. Five years ago I had it all. Only escape = starve to death
		eState[OPENING_SCENE] =2; // mark as ready
		//triggeredBy: starting the game
//---------------------------------------------------------------------------------------------------------
event =FIND_ABBE_WALL; // clue: hear scratching sound - the rats?
		dependsOn(OPENING_SCENE);
    eState[OPENING_SCENE] =2; // in case ESC skipped that
		triggeredBy(""); // dungeon for the insane, since Dante threatened guards. Insane e.g. the Abbe who claims to be wealthy and tries to bribe guards
//---------------------------------------------------------------------------------------------------------
event =FIND_ABBE_JUG;
		dependsOn(FIND_ABBE_WALL);
		triggeredBy(""); //
//---------------------------------------------------------------------------------------------------------
event =GAME_OVER_REMOVE_PEOPLE;
		dependsOn(VALENTINE_AND_MAXIMILIEN);
		needs(EVIL_M,999,0,0,""); //any static characters 
		// triggeredBy: SPECIAL CASE: triggered by leaving a room 
//-------------------------------------------------------------------------------
event =event +1; // for safety, to avoid crashes
	} // [end]
//----------------------------------------------------------------------------------------------------


